/**
* Created by yyr on 2018/1/10
*已设立基金》基本信息详情
*/
<template>
    <div>
        <div class="ca-box ca-m-t-20 ca-p-22" v-if="!isManageEdit">
            <el-row>
                <el-col :span="12" class="ca-title">
                    <h3>管理层</h3>
                </el-col>
                <el-col :span='12' class="ca-align-right">
                    <el-button type="text"  @click="fundManageEdit()" :disabled="!isAuthBasicEdit" class="ca-edit-btn el-icon-edit">编辑</el-button>
                </el-col>
            </el-row>
            <el-table
                stripe
                border
                :data="fundStratumList"
                style="width:100%" class="table_p_01 ca-m-t-15 ca-table">
                <el-table-column
                    prop="userName"
                    label="高管姓名">
                </el-table-column>
                <el-table-column
                    prop="sex"
                    label="性别">
                    <template slot-scope="scope">
                        {{scope.row.sex | csConstFilter('SEX')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="position"
                    label="职位">
                </el-table-column>
                <el-table-column
                    prop="tel"
                    label="电话">
                </el-table-column>
                <el-table-column
                    prop="mailbox"
                    label="邮箱">
                </el-table-column>
                <el-table-column
                    prop="fax"
                    label="传真">
                </el-table-column>
                <el-table-column
                    prop="remarks"
                    label="备注">
                </el-table-column>
            </el-table>
        </div>
        <csFundManageEdit
            v-if="isManageEdit"
            @isEdit="isEdit"
            @addRedDot="addRedDot"
            @addManageSingle="addManageSingle"
        ></csFundManageEdit>
    </div>
</template>

<script type="text/ecmascript-6">
    import {api} from '../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp';
    import {isNoAuth} from '__service/utils';
    export default {
        data() {
            return {
                isAuthBasicEdit: isNoAuth('已投资基金-基金详情-编辑'),
                itemId: this.$route.params.fundId,
                isManageEdit: false,
                fundStratumList: [],//数据
            }
        },
        props: {
        },
        created() {
            this.getManagementList();
        },
        methods: {
            getManagementList() {
                apiHttp(api.GET_MANAGEMENT,{fundId: this.itemId}).then( ret=> {
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.fundStratumList = ret.data;
                    }
                })
            },
            fundManageEdit() {
                this.isManageEdit = true;
            },
            //添加管理层一行
            addManageSingle() {
                this.fundStratumList.push({
                    fax: '',
                    fundId: this.itemId,
                    id: '',
                    mailbox: '',
                    position: '',
                    remarks: '',
                    sex: 0,
                    tel: '',
                    userName: '',
                })
            },
            isEdit(val) {
                this.isManageEdit = val;
                this.getManagementList();
            },
            addRedDot() {
                this.$emit('addRedDot',0)
            }
        },
        components: {
            'csFundManageEdit': require('./edit.vue'),
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
